package com.charging.common.pojo;

import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class JsonResult<T>{
    Integer code;
    String message;
    T data;

    public static JsonResult ok(Object data, String msg){
        JsonResult result = new JsonResult<>();
        result.setCode(2000);
        result.setMessage(msg);
        result.setData(data);
        return result;
    }
    public static JsonResult ok(Object data){
        return JsonResult.ok(data, null);
    }

}
